<!--<html>-->
<fieldset id="ranklist" <% if (cid) { %>cid="<%= cid %>"<% } %>>
  <div><legend><% if (cid) { %>Contest <%= cid %> 参赛者<% } else { %>排名<% } %></legend></div>
  <div class="tablebg">
    <div id="pager">
      <%- partial('pager', {page:page, n:n}) %>
      <div class="fr" id="filter">
        <div class="input-prepend">
          <span class="add-on"><i class="icon-search"></i></span>
          <input type="text" id="search" <% if (search) { %>value="<%= search %>"<% } %> title="User or Nickname" placeholder=" user or nick">
        </div>
        <div>
          <a href="javascript:;" class="uibtn uibtn-mini" id="fil">Filter</a>
        </div>
        <div>
          <a href="/ranklist<% if (cid) { %>?cid=<%= cid %><% } %>" class="uibtn uibtn-mini">Reset</a>
        </div>
      </div>
    </div>
    <div id="tablediv">
      <table class="table table-cf tdcenter" style="table-layout:fixed;" id="rank">
        <thead>
          <tr>
            <th style="width:60px;">Rank</th>
            <th style="width:150px;">User</th>
            <th style="width:150px;">Nickname</th>
            <th>Signature</th>
            <th style="width:70px;">Rating</th>
            <th style="width:70px;">Solved</th>
            <th style="width:70px;">Submit</th>
          </tr>
        </thead>
        <tbody>
        <% if (!users || users.length == 0) { %>
          <tr class="odd">
            <td class="error-text center" colspan="7">No Users are matched.</td>
          </tr>
        <% } else { %>
        <% if (user) { %>
          <% if (user.rank < (page-1)*pageNum+1) { %>
            <% users.unshift(user); %>
          <% } else if (user.rank > (page-1)*pageNum+users.length) { %>
            <% users.push(user); %>
          <% } %>
        <% } %>
        <% users.forEach(function(p, i){ %>
        <% var c, h = ''; %>
        <% if (i % 2 == 1) { %>
        <% c = 'even'; %>
        <% } else { %>
        <% c = 'odd'; %>
        <% } %>
        <% if (user && user.name == p.name) { %>
        <% h = ' highlight'; %>
        <% } %>
          <tr class="<%= c %><%= h %>">
            <td><%= p.rank ? p.rank : (page-1)*pageNum+i+1 %></td>
            <td>
              <a class="user user-<%= UC[p.name] %>" href="/user/<%= p.name %>" title="<%= UT[p.name] %> <%= p.name %>">
                <%= p.name %>
              </a>
            </td>
            <td>
              <span class="user user-gray">
                <%= p.nick %>
              </span>
            </td>
            <td class="ellipsis">
              <% if (p.signature) { %>
              <span class="user-gray" title="<%= p.signature %>"><%= p.signature %></span>
              <% } %>
            </td>
            <td>
              <% if (p.lastRatedContest) { %>
                <%= p.rating %>
              <% } else { %>
                <span class="user user-gray">-</span>
              <% } %>
            </td>
            <td>
              <a href="/status?name=<%= p.name %>&result=2">
                <%= p.solved %>
              </a>
            </td>
            <td>
              <a href="/status?name=<%= p.name %>">
                <%= p.submit %>
              </a>
            </td>
          </tr>
        <% }); %>
        <% } %>
        </tbody>
      </table>
    </div>
  </div>
</fieldset>